1. Field of the Invention
The invention relates to a repeater such as a router and in particular to a repeater and an inter-network repeating method which perform dynamic port forwarding setting to open a port and automatically close the dynamically opened port.
2. Description of the Related Art
ADSL and CATV have been in widespread use in order to establish continuous connection to a wide area network such as the Internet, with remarkable diffusion of broadband routers. With the currently used IP protocol IPv4, the absolute number of global IP addresses (hereinafter referred to as external IP addresses) is insufficient so that the NAT (Network Address Translation) feature or port forwarding feature (static IP masquerade) is used to compensate for the shortage of external IP addresses. The NAT feature converts, in an access from a device on a LAN to the Internet, its local IP address (internal IP address; hereinafter referred to as the IP address) to an external IP address of a router on a WAN.
An access from the Internet to a specific device on the LAN is made available by using the port forwarding feature (static IP masquerade) of the router. To be more precise, a conversion table of port numbers and IP addresses is set to the router and the external IP address and external port number of the router is specified in an access from the Internet. In response to the access, the router converts the external IP address to an IP address in accordance with the preset conversion table. This conversion allows an access to a device on a LAN having the IP address.
The port forwarding feature and the NAT feature have allowed a related art router to ease exhaustion of external IP addresses and connect a plurality of user devices on a LAN and the Internet. In this practice, the user had to acquire the port number of the device and manually perform or modify its setting.
Such manual setting is cumbersome and insufficient in terms of utilization of ports. To cope with this problem, the UPnP Forum defined a standard for setting of dynamic port forwarding (port mapping) (refer to UPnP Standard, [online], [searched Jan. 13, 2003], Internet address: “http//:www.upnp.org/standardizeddcps/default.asp). Setting in accordance with this standard lets a subordinate terminal request the router open a port. The router registers the port if possible. In case the port cannot be used, the terminal requests a second time and repeats the procedure until the port is determined to be available. In the UPnP standard, a port can be assigned for an indefinite or definite period. Use of the definite assignment automatically deletes a dynamically set external port without the intervention of a router vendor. FIG. 12 is a sequence chart showing the procedure from port assignment to port cancellation in related art dynamic port forwarding.
As shown in FIG. 12, when Server A to which the user has set the internal port number “8080” on the LAN is connected to the outer having the external IP address “232.0.0.1” (IP address “192.168.0.4” assigned by the DHCP server), Server A transmits a DHCP discovery packet and the DHCP server assigns the IP address “192.168.0.1”. Then Server A transmits a router discovery packet (sq 101) and the router responds thereto (sq 102). Receiving the discovery packet, Server A transmits a port registration request (sq 103) and the router assigns the external port number “80” in response (sq 104).
When a client terminal having the external IP address “232.0.0.2” connected to the Internet accesses Server A by using the address “http//:232.0.0.1:80” (sq 105), the router performs port forwarding to the address “http//:192.168.0.1:8080” (sq 106). Server A returns a response (sq 107), the client terminal makes an access for processing by Server A (sq 108), and Server A transmits a response ((sq 109). Then communications between the client terminal and Server A are ended. In case port assignment is based on an indefinite-period assignment request made by Server A, the port remains assigned to Server A when the communications are over.
As mentioned above, the related art port forwarding function by a router (static IP masquerade function) allows an access to a terminal in the LAN by using an external port number. This approach is cumbersome in that, each time the external port number is changed in accordance with the system change on the LAN side, the change in the IP number must be set manually.
For dynamic port forwarding by way of a standard from the UPnP Forum, in case port assignment is based on an indefinite-period assignment request made by the server or terminal, the port remains assigned to the serve or terminal when the communications are over. Thus, in case the application on the communicating terminal has terminated, the port remains assigned even when it is no longer used. This port could act as a security hole to allow an illegal access.